package code.db.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.apache.commons.lang.StringUtils;
import org.springframework.jdbc.core.RowMapper;

import code.domain.Table;

public class TableRowMapper implements RowMapper<Table>{

	public Table mapRow(ResultSet rs, int paramInt)
			throws SQLException {
		Table table = new Table();
		String name = rs.getString("TABLE_NAME");
		String desc = rs.getString("COMMENTS");	
		if(StringUtils.isBlank(desc)){
			desc = "";
		}
		table.setName(name);
		table.setDesc(desc);
		
		return table;
	}

}
